package DuoTai1.demo1;

public class Test {
    public static void main(String[] args){
        Animal a1 = new Cat();
        Animal a2 = new Dog();

        a1.eat();
        a2.eat();

        if(a1 instanceof Dog){
            Dog a3 = (Dog)a1;
            a3.lookHome();
        }

        if(a2 instanceof Dog){
            Dog a4 = (Dog)a2;
            a4.lookHome();
        }
//        Dog a5 = (Dog)a1;
    }
}
